package com.sskj.ffmpeg;

import com.sskj.websocket.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @Author: Like
 * @Date: 2024/12/20 10:44
 * @Description:
 */
@RequestMapping("/rtsp/test")
@RestController
public class Demo1 {

//    @Autowired
//    private RtspConvertHls rtspConvertHls;

    @Autowired
    private FfmpegRtspConvertHls rtspConvertHls;

    @GetMapping("/changePreviewUrl")
    public R changePreviewUrl(String rtspUrl, String code) {
        return R.ok(rtspConvertHls.startTransform(code,rtspUrl));
    }

    @GetMapping("/stopPreviewUrl")
    public R stopPreviewUrl(String code) {
        rtspConvertHls.stopTransform(code);
        return R.ok();
    }
}
